﻿using System;
using System.Collections.Generic;
using System.Text;
using Spring.Context;
using Spring.Context.Support;

namespace Framework.Core
{
    public class ObjectFactory
    {
        private static IApplicationContext ctx;
        private static bool isInit = false;

        public static void Init()
        {
            isInit = true;
            ctx = ContextRegistry.GetContext();
            if (ctx == null)
            {
                isInit = false;
            }
        }

        public static Object GetObject(string name)
        {
            if (!isInit)
            {
                Init();
            }
            return ctx.GetObject(name);
        }
    }
}
